package test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Indexed;
import test.pojo.MyClassLoader;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : example
 * @ Author: XuLeHuang
 * @ Date: 2022/7/22 15:21
 * @ Description:
 */
@SpringBootApplication
@Indexed
public class ApiUseApplication {

    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        SpringApplication.run(ApiUseApplication.class , args);
        System.out.println(System.getProperty("user.dir"));
        MyClassLoader loader = new MyClassLoader("myClassLoader");
        loader.setBasPath("D:\\");//指定自定义类加载器加载路径
        Class<?> clazz = loader.findClass("UserConfig"); //指定加载Car类
        System.out.println(clazz.getClassLoader());//输出加载类Car的加载器
        Object object = clazz.newInstance();//创建Car类对象，会调用构造方法
        System.out.println(object);
    }
}
